--------------------------------------------------------
--  File created - Wednesday-July-02-2014   
--------------------------------------------------------
DROP TABLE "MAPADMIN"."CASEDOC" cascade constraints;
DROP TABLE "MAPADMIN"."CASEHIST" cascade constraints;
DROP TABLE "MAPADMIN"."CASEMAST" cascade constraints;
DROP TABLE "MAPADMIN"."CASEOUTLET" cascade constraints;
DROP TABLE "MAPADMIN"."MERCHANT" cascade constraints;
DROP TABLE "MAPADMIN"."NOTIFICATION" cascade constraints;
DROP TABLE "MAPADMIN"."NTFQUEUE" cascade constraints;
DROP TABLE "MAPADMIN"."NTFTEMPLATE" cascade constraints;
DROP TABLE "MAPADMIN"."OUTLET" cascade constraints;
DROP TABLE "MAPADMIN"."STATUSMAST" cascade constraints;
DROP TABLE "MAPADMIN"."TBL_AUTOSCRIPT" cascade constraints;
DROP TABLE "MAPADMIN"."TBLACCESSMODULE" cascade constraints;
DROP TABLE "MAPADMIN"."TBLACCESSROLE" cascade constraints;
DROP TABLE "MAPADMIN"."TBLPARAMETERS" cascade constraints;
DROP TABLE "MAPADMIN"."TBLPROPERTY" cascade constraints;
DROP TABLE "MAPADMIN"."TBLPROPERTYDEFINITION" cascade constraints;
DROP TABLE "MAPADMIN"."TBLREFERENCE" cascade constraints;
DROP TABLE "MAPADMIN"."TBLREFLIST" cascade constraints;
DROP TABLE "MAPADMIN"."TBLROLEPERMISSION" cascade constraints;
DROP TABLE "MAPADMIN"."TBLSYSLOG" cascade constraints;
DROP TABLE "MAPADMIN"."TBLTREE" cascade constraints;
DROP TABLE "MAPADMIN"."TBLUSER" cascade constraints;
--------------------------------------------------------
--  DDL for Sequence SEQ_CASEDOC
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_CASEDOC";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_CASEDOC"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_CASEHIST
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_CASEHIST";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_CASEHIST"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_CASEMAST
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_CASEMAST";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_CASEMAST"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_MERCHANT
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_MERCHANT";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_MERCHANT"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_NOTIFICATION
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_NOTIFICATION";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_NOTIFICATION"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_NTFQUEUE
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_NTFQUEUE";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_NTFQUEUE"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_NTFTEMPLATE
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_NTFTEMPLATE";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_NTFTEMPLATE"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence SEQ_OUTLET
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."SEQ_OUTLET";
   CREATE SEQUENCE  "MAPADMIN"."SEQ_OUTLET"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence TBLREFERENCE_SEQ
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."TBLREFERENCE_SEQ";
   CREATE SEQUENCE  "MAPADMIN"."TBLREFERENCE_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence TBLREFLIST_SEQ
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."TBLREFLIST_SEQ";
   CREATE SEQUENCE  "MAPADMIN"."TBLREFLIST_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence TBLUSER_SEQ
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."TBLUSER_SEQ";
   CREATE SEQUENCE  "MAPADMIN"."TBLUSER_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Sequence S_TBLUSER
--------------------------------------------------------
   DROP SEQUENCE  "MAPADMIN"."S_TBLUSER";
   CREATE SEQUENCE  "MAPADMIN"."S_TBLUSER"  MINVALUE 0 MAXVALUE 999 INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLE ;
--------------------------------------------------------
--  DDL for Table CASEDOC
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."CASEDOC" 
   (	"CD_ID" NUMBER(16,0), 
	"CD_CASE_ID" NUMBER(16,0), 
	"CD_NAME" VARCHAR2(200 BYTE), 
	"CD_DATA" BLOB, 
	"CD_CREATED_DATE" DATE, 
	"CD_CREATED_BY" VARCHAR2(20 BYTE), 
	"CD_TYPE" VARCHAR2(100 BYTE), 
	"CD_LENGTH" NUMBER(16,0)
   ) ;
--------------------------------------------------------
--  DDL for Table CASEHIST
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."CASEHIST" 
   (	"CH_ID" NUMBER(16,0), 
	"CH_CASE_ID" NUMBER(16,0), 
	"CH_ACTION" VARCHAR2(50 BYTE), 
	"CH_STATUS" VARCHAR2(50 BYTE), 
	"CH_LAST_STATUS" VARCHAR2(50 BYTE), 
	"CH_NOTE" VARCHAR2(4000 BYTE), 
	"CH_CREATED_DATE" DATE, 
	"CH_CREATED_BY" VARCHAR2(20 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table CASEMAST
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."CASEMAST" 
   (	"C_ID" NUMBER(16,0), 
	"C_MERCHANT_ID" NUMBER(16,0), 
	"C_ACQUIRER" VARCHAR2(100 BYTE), 
	"C_MERCHANT_DETAILS" CLOB, 
	"C_MATCH_TRACE" CLOB, 
	"C_AMEX_AUTH_SIGN" CLOB, 
	"C_ACTION" VARCHAR2(50 BYTE), 
	"C_STATUS" VARCHAR2(50 BYTE), 
	"C_CREATED_DATE" DATE, 
	"C_CREATED_BY" VARCHAR2(20 BYTE), 
	"C_MODIFIED_DATE" DATE, 
	"C_MODIFIED_BY" VARCHAR2(20 BYTE), 
	"C_TYPE" VARCHAR2(20 BYTE), 
	"C_GROUP_CODE" VARCHAR2(20 BYTE), 
	"C_OTHER_OPT" CLOB, 
	"C_REFERENCE_NO" VARCHAR2(20 BYTE), 
	"C_REGION" VARCHAR2(3 BYTE), 
	"C_COUNTRY_CODE" VARCHAR2(3 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table CASEOUTLET
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."CASEOUTLET" 
   (	"CO_CASE_ID" NUMBER(16,0), 
	"CO_OUTLET_ID" NUMBER(16,0), 
	"CO_OUTLET_DETAILS" CLOB, 
	"CO_ESA_REF_NO" VARCHAR2(30 BYTE), 
	"CO_NUM_TERMINAL" NUMBER(4,0), 
	"CO_TRM_RENTAL" NUMBER(16,2), 
	"CO_TRM_OWNER" VARCHAR2(50 BYTE), 
	"CO_TRM_DEPOSIT_WIRED" NUMBER(16,2), 
	"CO_TRM_DEPOSIT_WIRELESS" NUMBER(16,2), 
	"CO_TRM_RENTAL_DEPOSIT_WIRED" NUMBER(16,2), 
	"CO_TRM_RENTAL_DEPOSIT_WIRELESS" NUMBER(16,2), 
	"CO_TRM_RENTAL_ADVANCE" NUMBER(16,2), 
	"CO_CHEQUE_AMT" NUMBER(16,2), 
	"CO_CHEQUE_ISSUER" VARCHAR2(100 BYTE), 
	"CO_CHEQUE_NO" VARCHAR2(20 BYTE), 
	"CO_CHEQUE_DATE" DATE, 
	"CO_MDR_RATE" CLOB, 
	"CO_STMT_OPTION" CLOB, 
	"CO_PYMT_OPTION" CLOB, 
	"CO_ADDRESS" CLOB, 
	"CO_TERMINAL_ID" VARCHAR2(30 BYTE), 
	"CO_TERMINAL_ID_NO" VARCHAR2(20 BYTE), 
	"CO_TERMINAL_INSTALL_DATE" VARCHAR2(20 BYTE), 
	"CO_OTHER_INFO" CLOB, 
	"CO_ADDRESS_2" CLOB, 
	"CO_ADDRESS_3" CLOB, 
	"CO_RECOMMENDATION" CLOB
   ) ;
--------------------------------------------------------
--  DDL for Table MERCHANT
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."MERCHANT" 
   (	"M_ID" NUMBER(16,0), 
	"M_NAME" VARCHAR2(100 BYTE), 
	"M_OWNERSHIP_STATUS" VARCHAR2(30 BYTE), 
	"M_REG_NO" VARCHAR2(30 BYTE), 
	"M_DESC" VARCHAR2(100 BYTE), 
	"M_MCC_CODE" VARCHAR2(20 BYTE), 
	"M_PAID_UP_CAPITAL" NUMBER(16,2), 
	"M_YEAR_IN_BUSINESS" VARCHAR2(20 BYTE), 
	"M_RECALL_BARCODE" VARCHAR2(30 BYTE), 
	"M_AVG_TICKET_SIZE" VARCHAR2(30 BYTE), 
	"M_CURR_BANK" VARCHAR2(100 BYTE), 
	"M_CURR_NO" VARCHAR2(20 BYTE), 
	"M_CURR_AVG_DEPOSIT" NUMBER(16,2), 
	"M_CURR_DTL_DEPOSIT" CLOB, 
	"M_AMEX_AUTH_SIGN" CLOB, 
	"M_MATCH_TRACE" CLOB, 
	"M_ADDRESS" CLOB, 
	"M_CREATED_DATE" DATE, 
	"M_CREATED_BY" VARCHAR2(20 BYTE), 
	"M_MODIFIED_DATE" DATE, 
	"M_MODIFIED_BY" VARCHAR2(20 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table NOTIFICATION
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."NOTIFICATION" 
   (	"N_ID" NUMBER(16,0), 
	"N_USER_ID" VARCHAR2(65 BYTE), 
	"N_CASE_ID" VARCHAR2(16 BYTE), 
	"N_TYPE" VARCHAR2(50 BYTE), 
	"N_CONTENT" CLOB, 
	"N_CREATED_DATE" DATE, 
	"N_CREATED_BY" VARCHAR2(20 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table NTFQUEUE
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."NTFQUEUE" 
   (	"NQ_ID" NUMBER(16,0), 
	"NQ_TO" VARCHAR2(100 BYTE), 
	"NQ_TYPE" VARCHAR2(50 BYTE), 
	"NQ_SUBJECT" CLOB, 
	"NQ_BODY" CLOB, 
	"NQ_STATUS" VARCHAR2(20 BYTE) DEFAULT 'Pending', 
	"NQ_SENT_DATE" DATE, 
	"NQ_STATUS_MSG" VARCHAR2(1000 BYTE), 
	"NQ_TRY_DATE" DATE, 
	"NQ_TRY" NUMBER(3,0) DEFAULT 0, 
	"NQ_CREATED_DATE" DATE, 
	"NQ_CREATED_BY" VARCHAR2(20 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table NTFTEMPLATE
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."NTFTEMPLATE" 
   (	"NT_ID" NUMBER(16,0), 
	"NT_CHANNEL" VARCHAR2(20 BYTE), 
	"NT_SUBJECT" CLOB, 
	"NT_TEMPLATE" CLOB, 
	"NT_CREATED_DATE" DATE, 
	"NT_CREATED_BY" VARCHAR2(20 BYTE), 
	"NT_MODIFIED_DATE" DATE, 
	"NT_MODIFIED_BY" VARCHAR2(20 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table OUTLET
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."OUTLET" 
   (	"O_ID" NUMBER(16,0), 
	"O_MERCHANT_ID" NUMBER(16,0), 
	"O_NAME" VARCHAR2(100 BYTE), 
	"O_REG_NAME" VARCHAR2(100 BYTE), 
	"O_REG_NO" VARCHAR2(30 BYTE), 
	"O_LICENSE_NO" VARCHAR2(30 BYTE), 
	"O_LICENSE_TYPE" VARCHAR2(30 BYTE), 
	"O_LICENSE_ISSUER" VARCHAR2(50 BYTE), 
	"O_LICENSE_STATE" VARCHAR2(50 BYTE), 
	"O_LICENSE_EXPIRY" VARCHAR2(30 BYTE), 
	"O_RISK" VARCHAR2(20 BYTE), 
	"O_CT_NAME" VARCHAR2(100 BYTE), 
	"O_CT_DESIGNATION" VARCHAR2(100 BYTE), 
	"O_CT_EMAIL" VARCHAR2(100 BYTE), 
	"O_CT_TEL" VARCHAR2(20 BYTE), 
	"O_CT_FAX" VARCHAR2(20 BYTE), 
	"O_ADDRESS" CLOB, 
	"O_MDR_RATE" CLOB, 
	"O_STMT_OPTION" CLOB, 
	"O_PYMT_OPTION" CLOB, 
	"O_CREATED_DATE" DATE, 
	"O_CREATED_BY" VARCHAR2(20 BYTE), 
	"O_MODIFIED_DATE" DATE, 
	"O_MODIFIED_BY" VARCHAR2(20 BYTE), 
	"O_OTHER_INFO" CLOB, 
	"O_ADDRESS_2" CLOB, 
	"O_ADDRESS_3" CLOB
   ) ;
--------------------------------------------------------
--  DDL for Table STATUSMAST
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."STATUSMAST" 
   (	"S_CURRENT" VARCHAR2(50 BYTE), 
	"S_ACTION" VARCHAR2(50 BYTE), 
	"S_NEXT" VARCHAR2(50 BYTE), 
	"S_GROUP" VARCHAR2(50 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table TBL_AUTOSCRIPT
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBL_AUTOSCRIPT" 
   (	"APPLICATION_ID" VARCHAR2(50 BYTE), 
	"PRODUCT_ID" VARCHAR2(50 BYTE), 
	"SCREEN_ID" VARCHAR2(50 BYTE), 
	"CONTENT_TEXT" VARCHAR2(2000 BYTE), 
	"CREATED_BY" VARCHAR2(60 BYTE), 
	"CREATED_DATE" DATE DEFAULT (sysdate), 
	"UPDATED_BY" VARCHAR2(60 BYTE), 
	"UPDATED_DATE" DATE DEFAULT (sysdate)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLACCESSMODULE
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLACCESSMODULE" 
   (	"MER_NAME" VARCHAR2(32 BYTE) DEFAULT 0, 
	"MODULE_CODE" VARCHAR2(10 BYTE) DEFAULT 0, 
	"MODULE_NAME" VARCHAR2(60 BYTE) DEFAULT 0, 
	"CREATED_BY" VARCHAR2(65 BYTE), 
	"CREATED_TIMESTAMP" TIMESTAMP (6), 
	"CREATED_DATE" TIMESTAMP (6)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLACCESSROLE
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLACCESSROLE" 
   (	"MER_NAME" VARCHAR2(32 BYTE), 
	"ROLE_CODE" VARCHAR2(10 BYTE), 
	"ROLE_NAME" VARCHAR2(65 BYTE), 
	"CREATED_BY" VARCHAR2(65 BYTE), 
	"CREATED_DATE" TIMESTAMP (6)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLPARAMETERS
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLPARAMETERS" 
   (	"MER_NAME" VARCHAR2(32 BYTE), 
	"PARAM_TYPE" VARCHAR2(5 BYTE), 
	"PARAM_CODE" VARCHAR2(30 BYTE), 
	"PARAM_NAME" VARCHAR2(60 BYTE), 
	"PARAM_VALUE" VARCHAR2(60 BYTE), 
	"PARAM_1" VARCHAR2(60 BYTE), 
	"PARAM_2" VARCHAR2(60 BYTE), 
	"PARAM_3" VARCHAR2(60 BYTE), 
	"PARAM_4" VARCHAR2(60 BYTE), 
	"CREATED_BY" VARCHAR2(65 BYTE), 
	"CREATED_DATE" TIMESTAMP (6)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLPROPERTY
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLPROPERTY" 
   (	"INSTANCE_KEY" VARCHAR2(32 BYTE), 
	"PROP_ID" NUMBER, 
	"VALUE" VARCHAR2(64 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLPROPERTYDEFINITION
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLPROPERTYDEFINITION" 
   (	"PROP_ID" NUMBER(18,0) DEFAULT 0, 
	"OWNER" VARCHAR2(32 BYTE) DEFAULT 0, 
	"PROP_NAME" VARCHAR2(32 BYTE) DEFAULT 0, 
	"DESCRIPTION" VARCHAR2(64 BYTE) DEFAULT 0
   ) ;
--------------------------------------------------------
--  DDL for Table TBLREFERENCE
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLREFERENCE" 
   (	"REF_ID" VARCHAR2(13 BYTE), 
	"REF_TYPE" VARCHAR2(5 BYTE), 
	"REF_VALUE" VARCHAR2(100 BYTE), 
	"REF_NAME" VARCHAR2(25 BYTE), 
	"REF_DESC" VARCHAR2(150 BYTE), 
	"REF_INSERT_DATE" DATE DEFAULT sysdate, 
	"REF_INSERT_BY" VARCHAR2(10 BYTE), 
	"REF_UPDATE_DATE" DATE, 
	"REF_UPDATE_BY" VARCHAR2(10 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLREFLIST
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLREFLIST" 
   (	"RLT_ID" VARCHAR2(13 BYTE), 
	"RLT_LISTNAME" VARCHAR2(25 BYTE), 
	"RLT_VALUE" VARCHAR2(100 BYTE), 
	"RLT_INSERT_DATE" DATE DEFAULT SYSDATE, 
	"RLT_INSERT_BY" VARCHAR2(10 BYTE), 
	"RLT_UPDATE_DATE" DATE, 
	"RLT_UPDATE_BY" VARCHAR2(10 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLROLEPERMISSION
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLROLEPERMISSION" 
   (	"MER_NAME" VARCHAR2(32 BYTE), 
	"ROLE_TYPE" VARCHAR2(2 BYTE), 
	"ROLE_CODE" VARCHAR2(10 BYTE), 
	"MODULE_CODE" VARCHAR2(10 BYTE), 
	"READ_FLAG" VARCHAR2(2 BYTE), 
	"UPDATE_FLAG" VARCHAR2(2 BYTE), 
	"WRITE_FLAG" VARCHAR2(2 BYTE), 
	"CREATED_BY" VARCHAR2(65 BYTE), 
	"CREATED_DATE" TIMESTAMP (6)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLSYSLOG
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLSYSLOG" 
   (	"ACTIVITYCODE" VARCHAR2(65 BYTE), 
	"ACTIVITYNAME" VARCHAR2(65 BYTE), 
	"ACCTID" VARCHAR2(65 BYTE), 
	"USERID" VARCHAR2(65 BYTE), 
	"ROLE" VARCHAR2(10 BYTE), 
	"STATUS" VARCHAR2(10 BYTE), 
	"DATE1" TIMESTAMP (6), 
	"DATE2" TIMESTAMP (6), 
	"USERFIELD1" VARCHAR2(65 BYTE), 
	"USERFIELD2" VARCHAR2(65 BYTE), 
	"USERFIELD3" VARCHAR2(65 BYTE), 
	"USERFIELD4" VARCHAR2(65 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLTREE
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLTREE" 
   (	"MER_NAME" VARCHAR2(32 BYTE), 
	"TREE_TYPE" VARCHAR2(2 BYTE), 
	"PARENT_ID" VARCHAR2(30 BYTE), 
	"CHILD_ID" VARCHAR2(30 BYTE), 
	"CREATED_BY" VARCHAR2(65 BYTE), 
	"CREATED_DATE" TIMESTAMP (6)
   ) ;
--------------------------------------------------------
--  DDL for Table TBLUSER
--------------------------------------------------------

  CREATE TABLE "MAPADMIN"."TBLUSER" 
   (	"ID" NUMBER(18,0), 
	"LOGIN_ID" VARCHAR2(65 BYTE), 
	"PASSWORD" VARCHAR2(65 BYTE), 
	"NAME" VARCHAR2(65 BYTE), 
	"MER_NAME" VARCHAR2(32 BYTE), 
	"LAST_LOGIN_TIMESTAMP" TIMESTAMP (6), 
	"LAST_LOGIN_IP" VARCHAR2(50 BYTE), 
	"ROLE_CODE" VARCHAR2(20 BYTE), 
	"BAD_PWD_NO_ATTEMPTS" NUMBER, 
	"CREATED_BY" VARCHAR2(65 BYTE), 
	"CREATED_TIMESTAMP" TIMESTAMP (6), 
	"LAST_UPDATED_TIMESTAMP" TIMESTAMP (6), 
	"LAST_UPDATED_BY" VARCHAR2(16 BYTE), 
	"CREATE_STATUS" VARCHAR2(1 BYTE), 
	"ENABLED" VARCHAR2(1 BYTE), 
	"LOCKED" VARCHAR2(1 BYTE), 
	"RESET_PWD_CHANGED" VARCHAR2(1 BYTE), 
	"LAST_PWD_CHANGED" TIMESTAMP (6), 
	"REMARKS" VARCHAR2(32 BYTE), 
	"RESET_PWD_FLAG" VARCHAR2(5 BYTE), 
	"NO_ACCESS_DATE" TIMESTAMP (6), 
	"FULL_NAME" VARCHAR2(120 BYTE), 
	"EMAIL" VARCHAR2(120 BYTE), 
	"DEPT" VARCHAR2(120 BYTE), 
	"REGION" VARCHAR2(3 BYTE), 
	"COUNTRY_CODE" VARCHAR2(3 BYTE)
   ) ;
--------------------------------------------------------
--  DDL for Index CASEDOC_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."CASEDOC_PK" ON "MAPADMIN"."CASEDOC" ("CD_ID") ;
--------------------------------------------------------
--  DDL for Index CASEHIST_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."CASEHIST_PK" ON "MAPADMIN"."CASEHIST" ("CH_ID") ;
--------------------------------------------------------
--  DDL for Index CASEMAST_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."CASEMAST_PK" ON "MAPADMIN"."CASEMAST" ("C_ID") ;
--------------------------------------------------------
--  DDL for Index CASEMAST_REF_IDX
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."CASEMAST_REF_IDX" ON "MAPADMIN"."CASEMAST" ("C_REFERENCE_NO") ;
--------------------------------------------------------
--  DDL for Index MERCHANT_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."MERCHANT_PK" ON "MAPADMIN"."MERCHANT" ("M_ID") ;
--------------------------------------------------------
--  DDL for Index TBLACCESSMODULE_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."TBLACCESSMODULE_PK" ON "MAPADMIN"."TBLACCESSMODULE" ("MER_NAME", "MODULE_CODE") ;
--------------------------------------------------------
--  DDL for Index TBLACCESSROLE_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."TBLACCESSROLE_PK" ON "MAPADMIN"."TBLACCESSROLE" ("MER_NAME", "ROLE_CODE") ;
--------------------------------------------------------
--  DDL for Index TBLREFERENCE_IDX1
--------------------------------------------------------

  CREATE INDEX "MAPADMIN"."TBLREFERENCE_IDX1" ON "MAPADMIN"."TBLREFERENCE" ("REF_TYPE", "REF_VALUE") ;
--------------------------------------------------------
--  DDL for Index TBLREFERENCE_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."TBLREFERENCE_PK" ON "MAPADMIN"."TBLREFERENCE" ("REF_ID") ;
--------------------------------------------------------
--  DDL for Index TBLROLEPERMISSION_IDX1
--------------------------------------------------------

  CREATE INDEX "MAPADMIN"."TBLROLEPERMISSION_IDX1" ON "MAPADMIN"."TBLROLEPERMISSION" ("MER_NAME", "ROLE_TYPE", "ROLE_CODE") ;
--------------------------------------------------------
--  DDL for Index TBLSYSLOG_IDX1
--------------------------------------------------------

  CREATE INDEX "MAPADMIN"."TBLSYSLOG_IDX1" ON "MAPADMIN"."TBLSYSLOG" ("USERID") ;
--------------------------------------------------------
--  DDL for Index TBLTREE_IDX1
--------------------------------------------------------

  CREATE INDEX "MAPADMIN"."TBLTREE_IDX1" ON "MAPADMIN"."TBLTREE" ("MER_NAME", "TREE_TYPE", "PARENT_ID") ;
--------------------------------------------------------
--  DDL for Index TBLTREE_IDX2
--------------------------------------------------------

  CREATE INDEX "MAPADMIN"."TBLTREE_IDX2" ON "MAPADMIN"."TBLTREE" ("MER_NAME", "TREE_TYPE", "CHILD_ID") ;
--------------------------------------------------------
--  DDL for Index TBLUSER_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MAPADMIN"."TBLUSER_PK" ON "MAPADMIN"."TBLUSER" ("ID") ;
--------------------------------------------------------
--  Constraints for Table TBLACCESSMODULE
--------------------------------------------------------

  ALTER TABLE "MAPADMIN"."TBLACCESSMODULE" ADD CONSTRAINT "TBLACCESSMODULE_PK" PRIMARY KEY ("MER_NAME", "MODULE_CODE");
--------------------------------------------------------
--  Constraints for Table TBLACCESSROLE
--------------------------------------------------------

  ALTER TABLE "MAPADMIN"."TBLACCESSROLE" ADD CONSTRAINT "TBLACCESSROLE_PK" PRIMARY KEY ("MER_NAME", "ROLE_CODE");
--------------------------------------------------------
--  Constraints for Table TBLPROPERTY
--------------------------------------------------------

  ALTER TABLE "MAPADMIN"."TBLPROPERTY" MODIFY ("PROP_ID" NOT NULL ENABLE);
  ALTER TABLE "MAPADMIN"."TBLPROPERTY" MODIFY ("INSTANCE_KEY" NOT NULL ENABLE);
--------------------------------------------------------
--  Constraints for Table TBLREFERENCE
--------------------------------------------------------

  ALTER TABLE "MAPADMIN"."TBLREFERENCE" ADD CONSTRAINT "TBLREFERENCE_PK" PRIMARY KEY ("REF_ID");
--------------------------------------------------------
--  Constraints for Table TBLUSER
--------------------------------------------------------

  ALTER TABLE "MAPADMIN"."TBLUSER" ADD CONSTRAINT "TBLUSER_PK" PRIMARY KEY ("ID");
  ALTER TABLE "MAPADMIN"."TBLUSER" MODIFY ("ID" NOT NULL ENABLE);
--------------------------------------------------------
--  DDL for Trigger TRIGGER_CASEDOC_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_CASEDOC_INS" 
BEFORE INSERT ON CASEDOC FOR EACH ROW
DECLARE
  tempId CASEDOC.CD_ID%TYPE;

BEGIN

  select SEQ_CASEDOC.nextval into tempId from dual;
  :NEW.CD_ID := tempId;

END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_CASEDOC_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_CASEHIST_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_CASEHIST_INS" 
BEFORE INSERT ON CASEHIST FOR EACH ROW
DECLARE
  histId CASEHIST.CH_ID%TYPE;

BEGIN

  select SEQ_CASEHIST.nextval into histId from dual;
  :NEW.CH_ID := histId;

END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_CASEHIST_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_CASEMAST_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_CASEMAST_INS" 
BEFORE INSERT ON CASEMAST FOR EACH ROW
DECLARE
  caseID CASEMAST.C_ID%TYPE;

BEGIN

  select SEQ_CASEMAST.nextval into caseID from dual;
  :NEW.C_ID := caseID;

END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_CASEMAST_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_MERCHANT_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_MERCHANT_INS" 
BEFORE INSERT ON MERCHANT FOR EACH ROW
DECLARE
  merchantId MERCHANT.M_ID%TYPE;

BEGIN

  select SEQ_MERCHANT.nextval into merchantId from dual;
  :NEW.M_ID := merchantId;

END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_MERCHANT_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_NOTIFICATION_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_NOTIFICATION_INS" 
BEFORE INSERT ON NOTIFICATION FOR EACH ROW
DECLARE
  notificationId NOTIFICATION.N_ID%TYPE;
  
BEGIN

  select SEQ_NOTIFICATION.nextval into notificationId from dual;  
  :NEW.N_ID := notificationId;
  
END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_NOTIFICATION_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_NTFQUEUE_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_NTFQUEUE_INS" 
BEFORE INSERT ON NTFQUEUE FOR EACH ROW
DECLARE
  queueId NTFQUEUE.NQ_ID%TYPE;
  
BEGIN

  select SEQ_NTFQUEUE.nextval into queueId from dual;  
  :NEW.NQ_ID := queueId;
  
END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_NTFQUEUE_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_NTFTEMPLATE_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_NTFTEMPLATE_INS" 
BEFORE INSERT ON NTFTEMPLATE FOR EACH ROW
DECLARE
  templateId NTFTEMPLATE.NT_ID%TYPE;
  
BEGIN

  select SEQ_NTFTEMPLATE.nextval into templateId from dual;  
  :NEW.NT_ID := templateId;
  
END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_NTFTEMPLATE_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TRIGGER_OUTLET_INS
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TRIGGER_OUTLET_INS" 
BEFORE INSERT ON OUTLET FOR EACH ROW
DECLARE
  tempId OUTLET.O_ID%TYPE;

BEGIN

  select SEQ_OUTLET.nextval into tempId from dual;
  :NEW.O_ID := tempId;

END;
/
ALTER TRIGGER "MAPADMIN"."TRIGGER_OUTLET_INS" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TBLREFERENCE_SEQ_TRIGGER
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TBLREFERENCE_SEQ_TRIGGER" before insert on MAPADMIN.TBLREFERENCE
for each row
begin
      select 'REF' || to_char(sysdate,'yymmdd') || MAPADMIN.TBLREFERENCE_SEQ.nextval
      into :new.REF_ID from dual;
end;
/
ALTER TRIGGER "MAPADMIN"."TBLREFERENCE_SEQ_TRIGGER" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TBLREFLIST_SEQ_TRIGGER
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TBLREFLIST_SEQ_TRIGGER" before insert on MAPADMIN.TBLREFLIST
for each row
begin
	  select 'RLT' || to_char(sysdate,'yymmdd') || lpad(MAPADMIN.TBLREFLIST_SEQ.nextval,4,0)
      into :new.RLT_ID from dual;
end;
/
ALTER TRIGGER "MAPADMIN"."TBLREFLIST_SEQ_TRIGGER" ENABLE;
--------------------------------------------------------
--  DDL for Trigger TBLUSER_TRIGGER
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."TBLUSER_TRIGGER" before insert on MAPADMIN.TBLUSER
for each row
begin
      select MAPADMIN.TBLUSER_SEQ.nextval
      into :new.ID from dual;
end;
/
ALTER TRIGGER "MAPADMIN"."TBLUSER_TRIGGER" ENABLE;
--------------------------------------------------------
--  DDL for Trigger T_TBLUSER_INSERT
--------------------------------------------------------

  CREATE OR REPLACE TRIGGER "MAPADMIN"."T_TBLUSER_INSERT" 
BEFORE INSERT ON TBLUSER
FOR EACH ROW
BEGIN
  SELECT S_TBLUSER.NEXTVAL
  INTO   :new.id
  FROM   dual;
END;
/
ALTER TRIGGER "MAPADMIN"."T_TBLUSER_INSERT" ENABLE;
